package com.koron.beetl;

import org.beetl.core.Format;

public class IsNumericFunction implements Format {
    @Override
    public Object format(Object data, String pattern) {
        if(data == null)
            return 1;
        Boolean strResult = data.toString().matches("^[+-]?(0|([1-9]\\d*))(\\.\\d+)?$");

        if(strResult == true) {
            return 2;
        } else {
            return 1;
        }
    }
}
